/*
   @Copyright:LeetCode
   @Author:   tjyemail
   @Problem:  http://leetcode.com/problems/sqrtx
   @Language: C++
   @Datetime: 19-06-19 16:21
   */

class Solution {
public:
	int mySqrt(int x) {
		double r=1.0;
		for(; abs(r*r-x)>1e-1; r=(r+x/r)/2);
		return r;
	}
};
